﻿@model IEnumerable<DataAccess.DB.XuatKho>

@{
    ViewBag.Title = "Thống kê hóa đơn";
    Layout = "~/Views/Shared/_Layout_Printf.cshtml";
}
<table>
    <tr>
        <td>
            <span>Cty CP dược VTYT Thái Bình - Kho OTC</span>
        </td>
        <td style="text-align: right">
            <span>Ngày</span> @DateTime.Now.Day <span>Tháng </span>@DateTime.Now.Month <span>Năm</span> @DateTime.Now.Year
        </td>
    </tr>
    <tr>
        <td style="padding-left: 38px">
            <span>0363841892</span> - <span>0363847620</span>
        </td>
        <td style="text-align: right"></td>
    </tr>
    <tr>
        <td colspan="2" style="text-align: center">
            <h1>Thống kê bán hàng</h1>
        </td>
    </tr>
</table>
<table class="ms-list-form">
    <tr>
        <th>
            <span>Mã HĐ</span>
        </th>

        <th>
            <span>Khách hàng</span>
        </th>
        <th>
            <span>NV giao dịch</span>
        </th>
        <th>
            <span>Ngày xuất kho</span>
        </th>
        <th>
            <span>Tổng thanh toán
            </span>
        </th>
        <th><span>Trạng thái</span></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td style="border-left: 1px solid #d4d4d4">
                @Html.DisplayFor(modelItem => item.MaHoaDon)
            </td>

            <td>
                @Html.DisplayFor(modelItem => item.KhachHang.MaKH)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UserProfile.Code)
            </td>

            <td>
                <span>@DuocThaiBinh.Common.Util.ConvertObjectToStringDateTime(item.NgayXuatKho)</span>
            </td>
            <td style="text-align: right">
                @Html.DisplayFor(modelItem => item.TongThanhToan)
            </td>
            <td>
                @{if (item.IsThanhToan == null)
                  {
                      <span>Chưa thanh toán</span>
                  }
                  else{
                    <span>Đã thanh toán</span>
                  }
                }
            </td>
        </tr>
    }

</table>
@{var currentRole = Roles.GetRolesForUser(User.Identity.Name);}
<table style="width: 50%">
    <tr>
        <td style="border: 1px solid #d4d4d4">Tổng tất cả thanh toán:        
            
        </td>
        <td style="border: 1px solid #d4d4d4">
            <input id="total" value="@ViewBag.TongXuatKho" readonly="true" style="border:none;width:auto"/>
        </td>
    </tr>
    @{if (currentRole.Contains("Administrator"))
      {
        <tr>
            <td style="border: 1px solid #d4d4d4">Tổng lãi : 
            </td>
            <td style="border: 1px solid #d4d4d4">
                <input id="totalLai" value="@ViewBag.TongLai" readonly="true" style="border:none;width:auto"/>
            </td>
        </tr>
      }
    }
</table>

<script type="text/ecmascript">
    $(document).ready(function () {
        $("#total").formatCurrency();
    });
</script>
